from time import sleep
import uiautomation
import pyautogui
class yijizhixing():
        his = uiautomation.WindowControl(searchDepth=1, Name='科玛奇医院信息管理系统')  # 锁定窗口
        his.SetFocus()
        zhuangtai = his.ComboBoxControl(AutomationId='cmbStatus', ClassName='ComboBox')
        daizhixing = zhuangtai.ListItemControl(ClassName='ListBoxItem',Name='待执行')
        yizhixing = zhuangtai.ListItemControl(ClassName='ListBoxItem',Name='已执行')
        quanbukeshi = his.RadioButtonControl(AutomationId='allDept_radio', ClassName='RadioButton',Name='全部科室')
        benkeshi = his.RadioButtonControl(ClassName='RadioButton',Name='本科室')
        shurukuang = his.EditControl(AutomationId='AutoSelectTextBox', ClassName='TextBox',foundIndex=3)
        chaxun = his.ButtonControl(AutomationId='search_btn', ClassName='Button',Name='查询')
        zhixing = his.ButtonControl(AutomationId='btnExec', ClassName='Button',Name='执行')
        quxiaozhixing = his.ButtonControl(AutomationId='btnCancelExec', ClassName='Button',Name='取消执行')
        hz1=his.DataItemControl(ClassName='DataGridRow',Name='Yuanbo.ChssClient.OutFeeManager.ViewModel.Inspection.MainModel',foundIndex=1)
        hz2=his.DataItemControl(ClassName='DataGridRow',Name='Yuanbo.ChssClient.OutFeeManager.ViewModel.Inspection.MainModel',foundIndex=2)
        hz3=his.DataItemControl(ClassName='DataGridRow',Name='Yuanbo.ChssClient.OutFeeManager.ViewModel.Inspection.MainModel',foundIndex=3)
        hz4=his.DataItemControl(ClassName='DataGridRow',Name='Yuanbo.ChssClient.OutFeeManager.ViewModel.Inspection.MainModel',foundIndex=4)
        hz5=his.DataItemControl(ClassName='DataGridRow',Name='Yuanbo.ChssClient.OutFeeManager.ViewModel.Inspection.MainModel',foundIndex=5)
        hz6=his.DataItemControl(ClassName='DataGridRow',Name='Yuanbo.ChssClient.OutFeeManager.ViewModel.Inspection.MainModel',foundIndex=6)
        huanzhe1 = hz1.CustomControl(ClassName='DataGridCell',Name='项: Yuanbo.ChssClient.OutFeeManager.ViewModel.Inspection.MainModel，列显示索引: 0')
        huanzhe2 = hz2.CustomControl(ClassName='DataGridCell',Name='项: Yuanbo.ChssClient.OutFeeManager.ViewModel.Inspection.MainModel，列显示索引: 0')
        huanzhe3 = hz3.CustomControl(ClassName='DataGridCell',Name='项: Yuanbo.ChssClient.OutFeeManager.ViewModel.Inspection.MainModel，列显示索引: 0')
        huanzhe4 = hz4.CustomControl(ClassName='DataGridCell',Name='项: Yuanbo.ChssClient.OutFeeManager.ViewModel.Inspection.MainModel，列显示索引: 0')
        huanzhe5 = hz5.CustomControl(ClassName='DataGridCell',Name='项: Yuanbo.ChssClient.OutFeeManager.ViewModel.Inspection.MainModel，列显示索引: 0')
        huanzhe6 = hz6.CustomControl(ClassName='DataGridCell',Name='项: Yuanbo.ChssClient.OutFeeManager.ViewModel.Inspection.MainModel，列显示索引: 0')
        zhixingtishianniuyes = his.WindowControl(ClassName='Window',Name='温馨提示').ButtonControl(AutomationId='YesBtn', ClassName='Button',Name='是')
        zhixingtishianniuno = his.WindowControl(ClassName='Window',Name='温馨提示').ButtonControl(AutomationId='NoBtn', ClassName='Button',Name='否')
        quxiaozhixinganniuyes= his.WindowControl(ClassName='Window',Name='系统提示').ButtonControl(AutomationId='YesBtn', ClassName='Button',Name='是')
        quxiaozhixingtishianniuno = his.WindowControl(ClassName='Window', Name='系统提示').ButtonControl(AutomationId='NoBtn',ClassName='Button',Name='否')


        #选择已执行
        def choose_yizhixing(self):
                self.zhuangtai.Click()
                self.yizhixing.Click()
        #选择待执行
        def choose_daizhixing(self):
                self.zhuangtai.Click()
                self.daizhixing.Click()
        #点击本科室
        def click_benkeshi_btn(self):
                self.benkeshi.Click()
        #点击全部科室
        def click_quanbukeshi_btn(self):
                self.quanbukeshi.Click()
        #输入框输入姓名
        def input_name(self,name):
                self.shurukuang.Click()
                pyautogui.hotkey('ctrl', 'a')
                pyautogui.press('back')
                self.shurukuang.SendKeys(name)
        #点击查询按钮
        def click_chaxun_btn(self):
                self.chaxun.Click()
        #点击执行按钮
        def click_zhixing_btn(self):
                self.zhixing.Click()
        #点击取消执行
        def click_quxiaozhixing_btn(self):
                self.quxiaozhixing.Click()
        #选择患者1
        def choose_hz1(self):
                self.huanzhe1.Click()
        #选择患者2
        def choose_hz2(self):
                self.huanzhe2.Click()
        #选择患者3
        def choose_hz3(self):
                self.huanzhe2.Click()
         #选择患者4
        def choose_hz4(self):
                self.huanzhe4.Click()
         #选择患者5
        def choose_hz5(self):
                self.huanzhe5.Click()
         #选择患者6
        def choose_hz6(self):
                self.huanzhe6.Click()
        #点击执行提示确定按钮
        def click_zxyes_btn(self):
                self.zhixingtishianniuyes.Click()
        #点击执行提示取消按钮
        def click_zxno_btn(self):
                self.zhixingtishianniuno.Click()
        #点击取消执行提示确定按钮
        def click_qxzxyes_btn(self):
                self.quxiaozhixinganniuyes.Click()
        #点击取消执行提示取消按钮
        def click_qxzxno_btn(self):
                self.quxiaozhixingtishianniuno.Click()
